# coding: utf8
# datetime: 2021-04-07
# 题目地址: https://leetcode-cn.com/problems/check-if-it-is-a-straight-line/


from typing import List


class Solution:
    def checkStraightLine(self, coordinates: List[List[int]]) -> bool:
        len_num = len(coordinates)
        if len_num < 2:
            return True
        for i in range(2, len_num):
            k1 = (coordinates[i][1]-coordinates[0][1])*(coordinates[i][0]-coordinates[1][0])
            k2 = (coordinates[i][0]-coordinates[0][0])*(coordinates[i][1]-coordinates[1][1])
            if k1 != k2:
                return False
        return True


coordinates = [[0,0],[0,5],[5,5],[5,0]]
a = Solution()
print(a.checkStraightLine(coordinates))